home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / iritsm3s.zip / GRAPHGEN.H < prev    next >
C/C++ Source or Header  |  1992-02-22  |  6KB  |  204 lines

  1. /*****************************************************************************
  2. *   "Irit" - the 3d polygonal solid modeller.                     *
  3. *                                         *
  4. * Written by:  Gershon Elber                Ver 1.0, Jan. 1992   *
  5. ******************************************************************************
  6. * Global definitions of    Graphics interface.                         *
  7. *****************************************************************************/
  8.  
  9. #ifndef    GRAPH_GEN_H    /* Define only once */
  10. #define    GRAPH_GEN_H
  11.  
  12. #include "irit_sm.h"
  13.  
  14. #ifdef __TURBOC__
  15.  
  16. #include <graphics.h>
  17. #include <intr_lib.h>
  18. #include <intr_gr.h>
  19.  
  20. #else
  21.  
  22. #ifdef DJGCC
  23.  
  24. #include <intr_lib.h>
  25. #include <intr_gr.h>
  26.  
  27. #endif /* DJGCC */
  28.  
  29. #ifdef  BLACK
  30. #undef  BLACK
  31. #endif
  32. #define BLACK        0 /* Must be inorder of XViewColorDefs - xgrphgen.c. */
  33. #ifdef  RED
  34. #undef  RED
  35. #endif
  36. #define RED        4
  37. #ifdef  GREEN
  38. #undef  GREEN
  39. #endif
  40. #define GREEN        2
  41. #ifdef  BLUE
  42. #undef  BLUE
  43. #endif
  44. #define BLUE        1
  45. #ifdef  YELLOW
  46. #undef  YELLOW
  47. #endif
  48. #define YELLOW        14
  49. #ifdef  CYAN
  50. #undef  CYAN
  51. #endif
  52. #define CYAN        3
  53. #ifdef  MAGENTA
  54. #undef  MAGENTA
  55. #endif
  56. #define MAGENTA        5
  57. #ifdef  WHITE
  58. #undef  WHITE
  59. #endif
  60. #define WHITE        15
  61. #define MAX_COLOR    15
  62.  
  63. #define SOLID_LINE    1
  64. #define DOTTED_LINE    2
  65.  
  66. #endif /* __MSDOS__ */
  67.  
  68. /* Name    of generic matric transformation saved by this program:    */
  69. #define GENERIC_MAT_FILE  "generic#.mat"   /* Generic mat file name to save. */
  70. #define GENERIC_GIF_FILE  "generic#.gif"   /* Generic gif file name to save. */
  71. #define GENERIC_PS_FILE   "generic#.ps"        /* Generic PS file name to save. */
  72.  
  73. /* The current NormalLength is divided by scalar to form real normal length: */
  74. #define NORMAL_DEFAULT_LENGTH    10
  75. #define NORMAL_SCALER_LENGTH    100
  76.  
  77. #define DEFAULT_COLOR        1      /* For objects with no color defined. */
  78.  
  79. #define VIEW_PERSPECTIVE    1                  /* View modes. */
  80. #define VIEW_ORTHOGRAPHIC    2
  81. #define DEFAULT_PERSPECTIVE_Z    -5.0           /* Default Z focal point. */
  82.  
  83. #define TRANS_SCREEN    1     /* Screen, Object coords. transformation mode. */
  84. #define TRANS_OBJECT    2
  85.  
  86. #define DEFAULT_NUM_OF_ISOLINES        10
  87. #define DEFAULT_SAMPLES_PER_CURVE    6
  88.  
  89. typedef enum {
  90.     EVENT_NONE,
  91.     EVENT_QUIT,
  92.     EVENT_SCR_OBJ_TGL,
  93.     EVENT_PERS_ORTHO_TGL,
  94.     EVENT_PERS_ORTHO_Z,
  95.     EVENT_ROTATE_X,
  96.     EVENT_ROTATE_Y,
  97.     EVENT_ROTATE_Z,
  98.     EVENT_TRANSLATE_X,
  99.     EVENT_TRANSLATE_Y,
  100.     EVENT_TRANSLATE_Z,
  101.     EVENT_SCALE,
  102.     EVENT_DEPTH_CUE,
  103.     EVENT_DRAW_SOLID,
  104.     EVENT_SAVE_MATRIX,
  105.     EVENT_SAVE_GIF,
  106.     EVENT_SAVE_PS,
  107.     EVENT_RESET_MATRIX
  108. } GraphicEventType;
  109.  
  110. extern int
  111.     GlblDoGraphics,                      /* If FALSE, disable graphics. */
  112.     GlblWasCtrlBrk,             /* TRUE if display was interrupted. */
  113.     GlblTransformMode,              /* Screen, Object coords. trans. mode. */
  114.     GlblViewMode,               /* Perspective, Orthographic etc. */
  115.     GlblDepthCue,                   /* Activate depth cueing. */
  116.     GlblDrawSolid;             /* Use hardware Z buffer rendering. */
  117.  
  118. /* And finally the external routine prototypes: */
  119.  
  120. GraphicEventType GGGetGraphicEvent(RealType *ChangeFactor);
  121. int GGIsAbortKeyPressed(void);
  122.  
  123. #if defined(__MSDOS__) || defined(DJGCC)
  124.  
  125. /* Interfacing routines to intr_lib - variables/functions from dosgraph.c */
  126. extern int ViewWindowID, InputWindowID, StatusWindowID, TransWindowID;
  127.  
  128. /* These constants should be supplied by the host program. */
  129. extern int
  130.     GlblWindowFrameWidth,                   /* Window color configuration. */
  131.     GlblViewFrameColor,
  132.     GlblViewBackColor,
  133.     GlblTransFrameColor,
  134.     GlblTransBackColor,
  135.     GlblStatusFrameColor,
  136.     GlblStatusBackColor,
  137.     GlblInputFrameColor,
  138.     GlblInputBackColor,
  139.     GlblDrawHeader,              /* Window general attributes configuration. */
  140.     GlblSmoothTextScroll,
  141.     GlblIntrSaveMethod,
  142.     GlblMouseSensitivity,
  143.     GlblJoystickExists,
  144.     GlblMouseExists;
  145. extern char
  146.     *GlblViewWndwPos,                    /* Window position configuration. */
  147.     *GlblTransWndwPos,
  148.     *GlblStatusWndwPos,
  149.     *GlblInputWndwPos,
  150.     *GlblIntrSaveDisk;
  151.  
  152. void GGInitIntrLibWindows(int GraphDriver, int FullTransMode);
  153. void GGClosIntrLibWindows(void);
  154. void GGSetStatusInputWindows(IntrBType HasStatusWndw, IntrBType HasInputWndw);
  155.  
  156. #ifdef __MSDOS__
  157. /* Use intr_lib routines to emulate inline the functions below. */
  158. #define GGInstallBGI(BGIDriverPath, NameMode) \
  159.            { GRInstallSVGA(NameMode); GRSetBGIPath(BGIDriverPath); }
  160. #endif /* __MSDOS__ */
  161.  
  162. #define GGInitGraph(GraphDriver, FullTransMode) \
  163.                  GGInitIntrLibWindows(GraphDriver, FullTransMode)
  164. #define GGCloseGraph()          GGClosIntrLibWindows();
  165. #define GGMyMove(x, y)          IntrWndwRMoveTo(x, y)
  166. #define GGMyDraw(x, y)          IntrWndwRLineTo(x, y)
  167. #define GGMySetColor(color)     GRSetColor(color)
  168. #define GGMySetLineStyle(Style) GRSetLineStyle(Style, 0, GR_NORM_WIDTH)
  169. #define GGClearTransArea()      IntrWndwClear(TransWindowID)
  170. #define GGClearViewArea()       IntrWndwClear(ViewWindowID)
  171. #define GGClearInputArea()      IntrWndwClear(InputWindowID)
  172. #define GGClearStatusArea()     IntrWndwClear(StatusWindowID)
  173. #define GGViewPortTransArea()   IntrWndwPop(TransWindowID, FALSE, FALSE)
  174. #define GGViewPortViewArea()    IntrWndwPop(ViewWindowID, FALSE, FALSE)
  175. #define GGViewPortInputArea()   IntrWndwPop(InputWindowID, FALSE, FALSE)
  176. #define GGViewPortStatusArea()  IntrWndwPop(StatusWindowID, FALSE, FALSE)
  177. #define GGTone            GRTone
  178.  
  179. #else
  180.  
  181. #ifdef __GL__
  182. extern char *GlblTransPrefPos;
  183. extern char *GlblViewPrefPos;
  184. #endif /* __GL__ */
  185.  
  186. void GGInitGraph(int argc, char **argv, int FullTransMode, int TransAlways);
  187. void GGCloseGraph(void);
  188. void GGMyMove(RealType x, RealType y);
  189. void GGMyDraw(RealType x, RealType y);
  190. void GGMySetColor(int color);
  191. void GGMySetLineStyle(int Style);
  192. void GGClearViewArea(void);
  193. #define GGClearTransArea() GGClearViewArea()
  194. void GGTone(int Frequency, int Duration);
  195. void GGGraphicFlush(void);
  196. #ifdef __GL__                       /* Only on gl based systems. */
  197. void GGMyDrawPolygonSolid(double *Vertex, float *Normal, int NewPoly);
  198. #endif /* __GL__ */
  199.  
  200. #endif /* __MSDOS__ || DJGCC */
  201.  
  202. #endif /* GRAPH_GEN_H */
  203.  
  204.